package com.dx.user.controller;


import com.dx.model.UserInfo;
import com.dx.user.feign.OrderServer;
import com.dx.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lzh on 2017/10/20.
 */
@RestController
public class userController {

    @Autowired
    private UserService userService;

    @Autowired
    private OrderServer orderServer;

    @RequestMapping(value = "/getUserById", method = RequestMethod.GET)
    public UserInfo getUserById(String userId) {
        return userService.getUserById(userId);
    }

    @RequestMapping(value = "getUserByOrderId",method = RequestMethod.GET)
    public UserInfo getUserByOrderId(Integer orderId){
        String userId=orderServer.getUserIdByOrderId(orderId);
        return userService.getUserById(userId);
    }
}
